<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>
<script>
window.onload = function (){
	var aInp = document.getElementsByTagName('input');
	
	// aInp[1].checked = false;
	// aInp[2].checked = true;
	
	aInp[0].onclick = function (){
		for( var i=1; i<aInp.length; i++ ){
			aInp[i].checked = !aInp[i].checked;		//是{}内的那部分，不是()内的
			/*
			if( aInp[i].checked ) {
				aInp[i].checked = false;
			} else {
				aInp[i].checked = true;
			}
			*/
		}
	};
};
</script>
</head>

<body>

<input type="button" value="反选" />
<ul>
	<li><input type="checkbox" checked /></li>
	<li><input type="checkbox" /></li>
	<li><input type="checkbox" checked /></li>
	<li><input type="checkbox" /></li>
	<li><input type="checkbox" /></li>
</ul>

</body>
</html>
